package jmvcclab.View;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import jmvcclab.Model.MainData;

public class CalcForm extends JFrame {

    private JPanel contentPanel;
    private MainData mainData;

    public CalcForm(MainData mainData) {
        //Create the frame
        super("Enjoy our calculator!");
        this.mainData = mainData;
        this.setResizable(false);

        // Create the container.
        contentPanel = new JPanel();
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));

        // Add the widgets.
        contentPanel.add(new IOPanel(mainData));
        contentPanel.add(new ButtonPanel());


        // Add the panel to the frame.
        this.getContentPane().add(contentPanel, BorderLayout.CENTER);

        // Exit when the window is closed.
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Show the content
        this.pack();
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }
}
